# Maintainer: Konstantin Gizdov <arch at kge dot pw>

_name=llvmlite
pkgbase="python-${_name}"
pkgname=("${pkgbase}")
pkgver=0.41.0
pkgrel=1
pkgdesc='A Lightweight LLVM Python Binding for Writing JIT Compilers'
arch=('loong64' 'x86_64')
depends=('gcc-libs' 'glibc' 'llvm14-libs' 'python')
makedepends=('cmake' 'git' 'llvm14' 'python-build' 'python-installer' 'python-setuptools-scm' 'python-wheel')
checkdepends=('python-pytest')
url="https://github.com/numba/${_name}"
license=('BSD')
source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz)
sha256sums=('7d41db345d76d2dfa31871178ce0d8e9fd8aa015aa1b7d4dab84b5cb393901e0')
b2sums=('7c0616c8d484140de3a882fa5b31a5191b0a7c70d8b80d05990504e7d1e5e986c211b326c51d7405dc0e258d52048dc6a60f059fbc31a3adccbaa5adb95877c3')

build() {
    cd "${_name}-$pkgver"
    export PATH="/usr/lib/llvm14/bin:$PATH"
    python -m build --wheel --no-isolation
}

check() {
    cd "${_name}-$pkgver"
    pytest -vv $_name/tests
}

package() {
    cd "${_name}-$pkgver"

    python -m installer --destdir="$pkgdir" dist/*.whl

    install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}/"
}
